package org.zfes.snowier.zbss.xzy.router.behaviour;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.zbss.xzy.biz.behaviour.model.BehaviourContent;
import org.zfes.snowier.zbss.xzy.biz.behaviour.service.IBehaviourContentService;
import org.zfes.snowier.core.data.SelectVo;
@Controller 
@RequestMapping("/behaviour")
public class BehaviourContentController implements BaseController {

	
	@Autowired
	private IBehaviourContentService behaviourContentService;
	
	//@RequiresPermissions(value="behaviourContent:loadBehaviourContentDataSet",desc="行为记录详情列表")
    @RequestMapping(value="/loadBehaviourContentDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadBehaviourContentDataSet(@RequestBody Map<String,Object> params){
	    DataSet dataSet=  behaviourContentService.loadBehaviourContentDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	//@RequiresPermissions(value="behaviourContent:createBehaviourContent",desc="行为记录详情添加")
    @RequestMapping(value="/createBehaviourContent", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public  @ResponseBody Object createBehaviourContent(@RequestBody BehaviourContent behaviourContent){
		behaviourContentService.createBehaviourContent(behaviourContent);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="behaviourContent:loadBehaviourContent",desc="行为记录详情加载")
    @RequestMapping(value="/loadBehaviourContent/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadBehaviourContent(@PathVariable("id")Long id){
		Optional<BehaviourContent> ops = behaviourContentService.loadBehaviourContentById(id);
		return ajaxQuery("behaviourContent",ops);
    }
	
	//@RequiresPermissions(value="behaviourContent:updateBehaviourContent",desc="行为记录详情更新")
    @RequestMapping(value="/updateBehaviourContent", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object updateBehaviourContent(@RequestBody  BehaviourContent behaviourContent){
		behaviourContentService.updateBehaviourContent(behaviourContent);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="behaviourContent:deletBehaviourContent",desc="行为记录详情删除")
    @RequestMapping(value="/deleteBehaviourContent/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object deleteBehaviourContent(@PathVariable("id")Long id){
		behaviourContentService.deleteBehaviourContent(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }


    @RequestMapping(value="/loadBehaviourContentSelectVo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadBehaviourContentSelectVo(){
		 List<SelectVo>  ops = behaviourContentService.loadBehaviourContentSelectVo("");
		return ajaxQuery("selectVo",ops);
    }
    
}